/**
 * Created by Aigo on 2017/05/31.
 */
$(function () {
    var sort = 102;
    //添加MET直播
    $("#addData").on("click", function () {
        var loginName = window.localStorage.getItem("loginName");
        $("#sort").val(sort);
        $("#createUser").val(loginName);
        $("#addForm").attr("action", getAdminIP() + "lives");
        $("#addForm").submit();
    })

    //取消添加MET直播  
    $("#cancelAdd").on("click", function () {
        window.history.go(-1);
    })

    //日期控件
    var startTime = {
        dateCell: "#startTime",
        format: 'YYYY-MM-DD hh:mm:ss',
        isinitVal: false,
        festival: false,
        ishmsVal: false,
        isTime: true,
        maxDate: '2099-06-16 23:59:59'
    };
    jeDate(startTime);
    var endTime = {
        dateCell: "#endTime",
        format: 'YYYY-MM-DD hh:mm:ss',
        isinitVal: false,
        festival: false,
        ishmsVal: false,
        isTime: true,
        maxDate: '2099-06-16 23:59:59'
    };
    jeDate(endTime);

    //实时预览图片
    $("#picUrl").on("change", function (e) {
        var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
        for (var i = 0, len = files.length; i < len; ++i) {
            var file = files[i];

            if (url) {
                src = url.createObjectURL(file);
            } else {
                src = e.target.result;
            }

            $("#loadImg").attr('src', src);
        }
    });
});
